local M = class("imgNumber", function ( ... )
	return display.newNode()
end);

function M:ctor(xxx,uiPath, ...)
	self.mUiPath = uiPath
	self._array = {}
	self._color = cc.c3b(255,255,255)
 end
function M:dtor()

end

function M:setNumber( formatNumber, space )
	self:removeAllChildren();
	self._array = {}
	local x, y = 0, 0;
	formatNumber = tostring(formatNumber)
	for i = 1, string.len(formatNumber) do
		local c = string.sub(formatNumber, i, i);
		local numImg 	= display.newSprite(self.mUiPath[c] or '');
		if numImg then
			local size = numImg:getContentSize();
			numImg:pos(x, y);
			numImg:setAnchorPoint(cc.p(1,0))
			x = x + size.width + (space or 0);
			self:addChild(numImg);
			self:setContentSize(x, size.height);
			self._array[#self._array+1] = numImg
		end
	end
	self:color(self._color)
	return self
end

function M:color(color)
	self._color = color
	for k,v in pairs(self._array) do
		v:setColor(color)
	end
	return self
end

return M